<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>warmer-redis</title>
  <script type="text/javascript" src="/js/jquery.js"></script>
  <script>
    function zan(id,opType){
      $.ajax({
        url:"/addZan/"+id+"/"+opType,
        type:"get",
        success:function(data){
          $("#countZan").text(data);
        }
      });
    }

  </script>
</head>
<body>
<h1 style="text-align: center">新闻1</h1>
阅读数<font color="red" th:text="${read}" ></font>&nbsp;&nbsp; 点赞数<font id="countZan" color="red" th:text="${countZan==null?0:countZan}"></font>&nbsp;&nbsp;
<input type="button" onclick="zan(1,1)" value="点赞"/>
<input type="button" onclick="zan(1,0)" value="取消点赞"/>

</body>
</html>